﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class management_Management : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
        {
            Request.Browser.Adapters.Clear();
        }

        if (Session[CE.Global.General.UserId] == null)
        {
            Response.Redirect("~/ManagementSecureLogin.aspx");
        }
        lblUser.Text = "Welcome " + Session[CE.Global.General.UserName].ToString();
        lblUser.ToolTip = lblUser.Text;
        if (Request.Params["menu"] != null)
        {
            if (Request.Params["menu"] == "0")
            {
                ManagementMenu1.Visible = false;
                UserMenu.Visible = false;
            }
            else
            {
                ManagementMenu1.Visible = true;
                UserMenu.Visible = true;
            }
        }
        if (Session[CE.Global.General.UserRole] != null && Session[CE.Global.General.UserRole].ToString() == "200")
        {
            ManagementMenu1.Visible = false;
            UserMenu.Visible = false;
        }

        if (!IsPostBack)
        {
            CE.User.AccountStatusDB _accountStatusdb = new CE.User.AccountStatusDB();
            int _pwdStatus = _accountStatusdb.GetLastPasswordChagedStatus(Convert.ToInt64(Session[CE.Global.General.UserId].ToString()));
            if (_pwdStatus == 1)
            {
                ManagementMenu1.Visible = false;
                UserMenu.Visible = false;
            }
            else
            {
                ManagementMenu1.Visible = true;
                UserMenu.Visible = true;
            }
        }
    }
}
